package com.xjoyt.pay.operater.auth.po;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

import com.fasterxml.jackson.annotation.JsonIgnore;

@Entity
@Table(name = "account_user_role")
public class UserRole {

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name = "id", length = 20)
	public long id;

	@ManyToOne(targetEntity = Role.class, cascade = {})
	@JoinColumn(name = "role_id", foreignKey = @ForeignKey(name = "none"))
	public Role role;

	@ManyToOne(targetEntity = AccountUser.class, cascade = {})
	@JoinColumn(name = "user_id", foreignKey = @ForeignKey(name = "none"))
	@JsonIgnore
	public AccountUser user;
}
